using System;
using System.Collections.Generic;
using System.Security.Cryptography;
using System.Text;
using System.Data;

using PlugNT.Safe;
using PlugNT.Cms.Custom;
using PlugNT.Database;
using PlugNT.Database.Common.Simple;
using PlugNT.App.Payment.Model;

namespace PlugNT.App.Payment.BLL
{
    public class Flow
    {

        private static readonly PlugNT.App.Payment.DAL.Flow dal = new PlugNT.App.Payment.DAL.Flow();


        public static string GetAddSql(FlowInfo model)
        {
            return PlugNT.App.Payment.DAL.Flow.GetAddSql(model);
        }









        public static DataTable GetList(int pageSize, int currPage, int userId, out int recordCount)
        {
            StringBuilder andwhere = new StringBuilder();
            if (userId > 0)
            {
                andwhere.Append(" and [user_id]=" + userId.ToString());
            }
            recordCount = dal.GetCount(andwhere.ToString());
            return dal.GetList( pageSize, currPage, andwhere.ToString());
        }










        public static DataTable GetJoinList(int pageSize, int currPage, int userId, out int recordCount)
        {
            LeftJoinInfo joininfo = new LeftJoinInfo(WebConfig.UsersTableName, "username,email", "user_id", WebConfig.GetUserField("id"), "");
            recordCount = dal.GetCount(" and [user_id]=" + userId.ToString());
            return dal.GetList( pageSize, currPage," and [user_id]=" + userId.ToString(), joininfo);
        }





        public static FlowInfo GetFlowInfo(int id)
        {
            return PlugNT.App.Payment.DAL.Flow.GetFlowInfo(id);
        }



        public static FlowInfo GetFlowInfo(string no)
        {
            return PlugNT.App.Payment.DAL.Flow.GetFlowInfo(no);
        }


    }
}

